#ifndef GLWIDGET_H
#define GLWIDGET_H

#include "glew.h"
#include "Camera.hpp"
#include "Logger.hpp"
#include "Random.hpp"
#include "Street.hpp"
#include "Page.hpp"
#include "Renderer.hpp"
#include <iostream>
#include <ctime>
#include <QtOpenGL>

class Page;
class Camera;

#include <list>

class GLWidget : public QGLWidget
{
    Q_OBJECT

public:
    // Constructors and Destructors
    GLWidget(QWidget *parent = 0);
     ~GLWidget();

     // Accessors
     QSize minimumSizeHint() const;
     QSize sizeHint() const;

 public slots:
     // Mutators
     void forceRedraw();
     void reportFrameRate();
     void updateGL();

 protected:
     void initializeGL();
     void paintGL();
     void resizeGL( int width, int height );
     void mousePressEvent( QMouseEvent *event );
     void mouseMoveEvent( QMouseEvent *event );
 	 void keyPressEvent( QKeyEvent *e );
     void keyReleaseEvent( QKeyEvent *e );
     void integrateCamera();
	
 protected:
     Camera* m_camera;

 private:
     QTimer redrawTimer;
     QTimer reportFrameTimer;
     clock_t lastTick;
     int frameCount;
     int lastFPS;

     bool m_WKeyPressed;
     bool m_AKeyPressed;
     bool m_SKeyPressed;
     bool m_DKeyPressed;
     bool m_QKeyPressed;
     bool m_EKeyPressed;
     bool m_ShiftKeyPressed;

     Qt::MouseButtons currentMouseButtons;
     QPoint lastPos;
 };

#endif // GLWIDGET_H
